<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
Use Illuminate\Support\Facades\DB;

class CreateRedBagTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('red_bag', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('higher_uid')->comment('上级id 分享人id 红包收益者')->default(0);
            $table->integer('lower_uid') ->comment('下级id 应邀人id  红包生产者')->default(0);
            $table->decimal('total_amount') ->comment('红包金额')->default(0);
            $table->timestamp('created_at') ->comment('领取时间')->default(DB::raw('CURRENT_TIMESTAMP'));

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('red_bag');
    }
}
